/*
   Copyright (C) 2008 Yen-Ju Chen <yjchenx gmail>

   This application is free software; you can redistribute it and/or 
   modify it under the terms of the MIT license. See COPYING.

*/

#import <Foundation/Foundation.h>
#import <BioCocoa/BCFoundation.h>
#import "ICCollection.h"

/** Responsible for saving and loading data */

@interface ICCollectionManager: NSObject
{
	NSMutableArray *defaultCollections;
	NSMutableArray *customCollections;
  ICCollection *geneCollection;
  ICCollection *primerCollection;
  ICCollection *plasmidCollection;
	NSMutableDictionary *library;

	/* Accessory */
	BCSequenceReader *sequenceReader;
	BCSequenceWriter *sequenceWriter;
}

+ (ICCollectionManager *) defaultManager;

/** Add an item and sort them into gene, primer and plasmid */
- (void) addItem: (ICItem *) item;
/** Remove an item from all libraries and collections */
- (void) removeItem: (ICItem *) item;
/** Save sequence of item to file */
- (void) saveSequenceOfItem: (ICItem *) item;
/** Put item into right collection */
- (void) organizeItem: (ICItem *) item;

- (ICCollection *) geneCollection;
- (ICCollection *) primerCollection;
- (ICCollection *) plasmidCollection;

- (NSInteger) numberOfDefaultCollections;
- (NSInteger) numberOfCustomCollections;

- (ICCollection *) defaultCollectionAtIndex: (NSInteger) index;
- (ICCollection *) customCollectionAtIndex: (NSInteger) index;

- (void) saveDatabase;
- (void) loadDatabase;

@end
